﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using SPORTSALE.Data;

namespace SPORTSALE
{
    enum Categoria
    {
        Acuatico = 1,
        Nieve = 2,
        Pelota = 3,
        Gimnasia = 4,
        Aeronauticos = 5,
        Atletismo = 6
    }

    public partial class Products : System.Web.UI.Page
    {
        SPORTSALEEntities context = new SPORTSALEEntities();

        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        private void GenerateDataSource()
        {
            GridView1.DataSource = context.Products;
            GridView1.AutoGenerateColumns = true;
            GridView1.DataBind();
        }

        protected void btnBuscar_Click(object sender, EventArgs e)
        {
            GenerateDataSource();
        }

        protected void cboCategoria_SelectedIndexChanged(object sender, EventArgs e)
        {
            cboDeporte.Items.Clear();
            
            switch (cboCategoria.SelectedIndex)
            {
                case (int)Categoria.Acuatico:
                    cboDeporte.Items.Add(new ListItem("Bodyboard", ""));
                    cboDeporte.Items.Add(new ListItem("Waterpolo", ""));
                    cboDeporte.Items.Add(new ListItem("Surf", ""));
                    cboDeporte.Items.Add(new ListItem("Buceo", ""));
                    break;

                case (int)Categoria.Aeronauticos:
                    cboDeporte.Items.Add(new ListItem("Aerostato", ""));
                    cboDeporte.Items.Add(new ListItem("Paracaidismo", ""));
                    cboDeporte.Items.Add(new ListItem("Parapente", ""));
                    cboDeporte.Items.Add(new ListItem("Sky surfing", ""));
                    break;

                case (int)Categoria.Atletismo:
                    cboDeporte.Items.Add(new ListItem("Carreras de velocidad", ""));
                    cboDeporte.Items.Add(new ListItem("Salto atlético", ""));
                    cboDeporte.Items.Add(new ListItem("Marcha atlética", ""));
                    cboDeporte.Items.Add(new ListItem("Lanzamientos", ""));
                    break;

                case (int)Categoria.Nieve:
                    cboDeporte.Items.Add(new ListItem("Skiing", ""));
                    cboDeporte.Items.Add(new ListItem("Snowboarding", ""));
                    cboDeporte.Items.Add(new ListItem("Snowkiting", ""));
                    cboDeporte.Items.Add(new ListItem("Snowshoeing", ""));
                    break;

                case (int)Categoria.Pelota:
                    cboDeporte.Items.Add(new ListItem("Bádminton", ""));
                    cboDeporte.Items.Add(new ListItem("Squash", ""));
                    cboDeporte.Items.Add(new ListItem("Paddle", ""));
                    cboDeporte.Items.Add(new ListItem("Ping pong", ""));
                    break;

                case (int)Categoria.Gimnasia:
                    cboDeporte.Items.Add(new ListItem("Aeróbic", ""));
                    cboDeporte.Items.Add(new ListItem("Trampolining", ""));
                    cboDeporte.Items.Add(new ListItem("Gimnasia rítmica", ""));
                    cboDeporte.Items.Add(new ListItem("Cheerleading", ""));
                    break;

                default:

                    break;
            }
        }
    }
}